home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / libs / sphigs / sph_mac.hqx / SRGP port to 5.0 (compressed) / SRGP_SPHIGS Root / MacSPHIGS / sph_pdc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1992-02-13  |  1.7 KB  |  60 lines

  1. #include "HEADERS.h"
  2. /**********************
  3.                       *
  4.  File                 * gen_pdc_verts.c
  5.                       * calculates pdc points from npc vertices
  6.                       *
  7.                       * changes pdc points
  8.                       * assumes map_to_canon was called before
  9.               *
  10.                       *********************************************************/
  11.  
  12. /**********************
  13.                       *
  14.  Includes          *
  15.                       *
  16.                       *********************************************************/
  17.  
  18. #include <stdio.h>
  19. #include "sphigslocal.h"
  20. #include <assert.h>
  21.  
  22. #include "sph_pdc.proto.h"
  23.  
  24. /**********************
  25.                       *
  26.  Function          * generate_pdc_vertices
  27.                       *
  28.                       * calculates the pdc points from the npc vertices
  29.               *
  30.                       *********************************************************/
  31. void  
  32. SPH__generate_pdc_vertices (view_spec *vs)
  33. {
  34.      MAT3hvec        result_vec;
  35.      MAT3hvec *        scanNPCvertex;
  36.      srgp__point *    scanPDCvertex;
  37.      MAT3vec        tempVertex;
  38.      int        count;
  39.  
  40.      scanNPCvertex = vs->npcVertices;
  41.  
  42.      if (vs->pdcVertices)
  43.       free (vs->pdcVertices);
  44.      
  45.      vs->pdcVertices = 
  46.     (srgp__point*) malloc (vs->vertexCount * sizeof(srgp__point));
  47.      assert( vs->pdcVertices != NULL );
  48.      
  49.      scanPDCvertex = vs->pdcVertices;
  50.      
  51.      for (count = 0; count < vs->vertexCount; count++) {
  52.       tempVertex[0] = (* scanNPCvertex)[0] * SPH_ndcSpaceSizeInPixels;
  53.       tempVertex[1] = (* scanNPCvertex)[1] * SPH_ndcSpaceSizeInPixels;
  54.       scanPDCvertex->x = irint( tempVertex[0] );
  55.       scanPDCvertex->y = irint( tempVertex[1] );
  56.       scanPDCvertex++;
  57.       scanNPCvertex++;
  58.      }
  59. }
  60.